<?php 

//电子邮件发送程序

require("smtp.php");





function send_mail($mailaddress_once,$mailcontent,$location)
{
//send mail on




$mailaddress[] = $mailaddress_once;

 $location;
 $content=addslashes($mailcontent);




//设置邮件的默认配置
    $smtpserver = "smtp.mxhichina.com";//SMTP服务器
    $smtpserverport = 25;//SMTP服务器端口
    $smtpusermail = "mail@circledesign.cn";//SMTP服务器的用户邮箱

    $smtpuser = "mail@circledesign.cn";//SMTP服务器的用户帐号
    $smtppass = "Kk98154981";//SMTP服务器的用户密码
    $mailsubject = "=?UTF-8?B?".base64_encode('用户密码找回')."?=";//邮件主题
    $mailbody = '<table class="email-table" cellspacing="0" cellpadding="0" style="padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal; width: 100%; max-width: 690px; margin: 0 auto;" width="100%" align="center">
  <tbody style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
    <tr style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
      <td class="content" style="font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal; max-width: 690px; margin: 0 auto; padding: 40px 30px; overflow: hidden; background: #fff; border-radius: 3px; box-sizing: border-box; border: 1px solid #d9d9d9;" align="center"><table cellspacing="0" cellpadding="0" style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal; width: 100%;" width="100%" align="center">
          <tbody style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
            <tr style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
              <td style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center"><table cellspacing="0" cellpadding="0" style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal; width: 100%;" width="100%" align="center">
                  <tbody style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
                    
                    <tr style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
                      <td class="user" style="margin: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal; padding: 20px auto;" align="center"><h2 class="user-info" style="padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; text-align: center; word-break: normal; font-weight: normal; margin: 20px auto; color: #383838; font-size: 20px;">您好！</h2></td>
                    </tr>
                    <tr style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
                      <td class="message" style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center"><h2 style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; text-align: center; word-break: normal; font-weight: normal; display: inline; color: #808080; font-size: 18px;">您刚刚请求了重置密码，请点击重置密码按钮修改登录密码</h2></td>
                    </tr>
                    <tr style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
                      <td style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center"><a class="btn" href="http://'.$location.'/email_pass.html'.$mailcontent.'" style="padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; text-align: center; font-weight: normal; word-break: break-word; display: block; width: 200px; height: 54px; margin: 30px auto; margin-bottom: 20px; font-size: 20px; line-height: 54px; border-radius: 2px; background: #3da8f5; text-decoration: none; color: #fff; border: 0; cursor: pointer;" rel="noopener" target="_blank">重置密码</a></td>
                    </tr>
                  </tbody>
                </table></td>
            </tr>
            <tr style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;" align="center">
              <td class="hint" style="padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal; display: block; max-width: 600px; margin: 0 auto; color: #a6a6a6; line-height: 24px;" align="center"><p style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; word-break: normal; font-weight: normal;">如果按钮无法点击，请直接访问以下链接：<a class="link" href="http://'.$location.'/email_pass.html'.$mailcontent.'" style="margin: 0; padding: 0; font-family: Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; font-size: 14px; text-align: center; font-weight: normal; word-break: break-word; color: #3da8f5;" rel="noopener" target="_blank">http://'.$location.'/email_pass.html'.$mailcontent.'</a>（为保障账号安全性，该链接仅在 24 小时内有效。如果您并不想更换密码，无需进行任何操作）</p></td>
            </tr>
          </tbody>
        </table></td>
    </tr>
    
  </tbody>
</table>';

//邮件内容
    $mailtype = "HTML";//邮件格式（HTML/TXT）,TXT为文本邮件


//开始循环每个地址，存在就发送出去。
for($i=0;$i<=count($mailaddress);$i++)
{

if($mailaddress[$i])
{
$smtpemailto = $mailaddress[$i];//发送给谁
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证. 
$smtp->debug = false;//是否显示发送的调试信息 
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
}

}


}
 

?>
 
